package com.atguigu.spring.ioc.controller;

import com.atguigu.spring.ioc.bean.Person;
import com.atguigu.spring.ioc.service.UserService;
import lombok.Data;
import lombok.ToString;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.util.List;
import java.util.Map;

@ToString
@Data
@Controller
public class UserController {

    /**
     * 自动装配流程
     * 1. 按照类型找
     * 2. 1找到多个,再按变量名确定
     */
    // 自动装配注解 原理：Spring 调用容器的getBean
    @Autowired
    UserService userService;

    @Autowired
    List<Person> persons;

    @Autowired
    Map<String, Person> map;
}
